<?php

class M_status_po extends CI_Model {

	function __construct()
	{
		parent::__construct();
		$this->load->model('pembelian/m_po','',TRUE);
	}

	function index()
	{
		$this->tampil();
	}

	function tampil()
	{
		$this->load->view('transaksi/vstatus_so');
	}

	function tampil_detail_po()
	{
		$nontender = $this->mso->tampil_detail_po();
		$ilc['nontender'] = $nontender;
        $ilc['title']     = "Transaksi &raquo Penjualan &raquo Status SO &raquo Non Tender";
		$this->load->view('transaksi/vstatus_so',$ilc);
	}
    
    function detail_po()
    {
        
        if($this->input->post('key'))
        {
            $key  = $this->input->post('key');
            //echo $key;exit;
            //$cari = $this->mso->caribykey($key);
            $row        = $this->mpo->detail_so_bykey($key); 
            $ilc['ilc'] = $row;
            $soid       = $row->soid;    
        }
        else
        {
            $soid         = $this->uri->segment(4);
            $ilc['ilc']   = $this->mso->detail_so($soid);     
        }

        $ilc['title'] = "Transaksi &raquo Penjualan &raquo Status SO &raquo Non Tender &raquo Detail SO &raquo No SO : $soid";
        $this->load->view('transaksi/vdetail_so',$ilc);
    }
    
    function batal()
    {
        $soid = $this->uri->segment(4);
        $sql  = "delete from sale where soid = '$soid'";
        $this->db->query($sql);
        
        redirect('transaksi/status_so/tampil_nontender');
    }
}
?>